# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Math-Calculus-FalsePosition.t'

use Test::More tests => 3;
BEGIN { use_ok('Math::Calculus::FalsePosition') };

my ($exp, $var) = ('x^3 + (- 9*x ) + 3', 'x');
diag( "\nExpression: " . $exp );

my $expected = 0.337608955965838;
diag( "Expected: x=" . $expected );

my $falsePos = Math::Calculus::FalsePosition->new(
    expression => $exp,
    variable   => $var,
    start      => 0,
    end        => 1,
    precision  => 15
);
ok($falsePos->validate, "initial validation");

my $got = $falsePos->run;
diag( "Got: x=" . $got );

cmp_ok( sprintf( "%.15f", $got ), '==', $expected, 'false position run' );

#########################

# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.

